//
//  GetScanViewController.swift
//  AutoPrint
//
//  Created by 胡玉葱 on 16/10/22.
//  Copyright © 2016年 fatcat. All rights reserved.
//

import UIKit

@objc protocol GetScanViewControllerDelegate {
    optional func didFinishedGetCode(code: String?, orderID: String?)
}

class GetScanViewController: LBXScanViewController {

    var oid:String?
    var delegate: GetScanViewControllerDelegate?
    
    override func viewDidLoad() {
        super.viewDidLoad()
        navigationController?.navigationBar.tintColor = UIColor.whiteColor()
        // Do any additional setup after loading the view.
    }

    override func handleCodeResult(arrayResult: [LBXScanResult]) {
        if arrayResult.first != nil{
            delegate?.didFinishedGetCode?(arrayResult.first?.strScanned, orderID: oid)
            
            navigationController?.popViewControllerAnimated(true)
            
        }else{
            UIAlertView(title: "ScanError", message: nil, delegate: nil, cancelButtonTitle: "OK").show()
        }
        
        
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
